<template>
  <div id="main">
    <div id="" class="card">
      <div style="width: 1000px;height: auto; margin: auto;padding: 5px">
        <!--操作按钮-->
        <el-form :inline="true" class="demo-form-inline center" >
          <el-row :gutter="18">
            <el-col :span="3"><el-button icon="el-icon-refresh"  onclick="history.go(-1)">返回</el-button></el-col>
          </el-row>
        </el-form>

        <el-form :inline="true" class="demo-form-inline">
          <el-row>
            <el-col :span="16">
              <el-form-item label="订单编号:">
                <input v-model="PurchaseOrders.purchaseOrderNumber" style="border: none" readonly>
              </el-form-item>
            </el-col>
            <el-col :span="5">
              <el-form-item label="总计:">
                <input v-model="PurchaseOrders.purchaseOrderAmount"  style="border: none">
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="16">
              <el-form-item label="登记人:">
                <input v-model="PurchaseOrders.register" style="border: none" readonly>
              </el-form-item>
            </el-col>
            <el-col :span="7">
              <el-form-item label="登记时间:">
                <el-input v-model="PurchaseOrders.purchaseOrderTime" disabled></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <!--数据表格-->
        <el-table
            :data="orders">
          <el-table-column
              prop="imgUrl"
              label="图片"
              width="180">
          </el-table-column>
          <el-table-column
              prop="productName"
              label="商品名称"
              width="180">
          </el-table-column>
          <el-table-column
              prop="productPrice"
              label="单价(元)"
              width="180">
          </el-table-column>
          <el-table-column
              prop="count"
              label="数量(件)"
              width="180">
          </el-table-column>
          <el-table-column
              prop="total"
              label="小计(元)"
              width="180">
            <template slot-scope="scope">
              <span>{{scope.row.total}}元</span>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "PurDateil",
  data(){
    return{
      PurchaseOrders: {},
      orders:[]
    }
  },
  created() {
    this.getOne()
  },
  methods:{
    async getOne(){
     const id=sessionStorage.getItem("PurId")
      const {data :res}=await this.$http.post
      (`purchaseOrder/getOne/${id}`)
      this.PurchaseOrders=res

      const {data :orders}=await this.$http.post
      (`purchaseOrderDetails/getByParentId/${id}`)
      this.orders=orders
    },
  }
}
</script>

<style scoped>
.card {
  box-sizing: border-box;
  padding: 20px;
  overflow-x: hidden;
  background-color: #ffffff;
  border: 1px solid #e4e7ed;
  border-radius: 6px;
  box-shadow: 0 0 12px #0000000d
}
.page{
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}
</style>